package goComfyuiApi

import (
	"fmt"
	"net/http"
)

// 打断工作流
func ApiInterruptWorkflow(comfyuiUrl string) error {
	url := genComfyUIApiUrl(comfyuiUrl, "interrupt")

	req, err := http.NewRequest("POST", url, nil)
	if err != nil {
		return err
	}

	c := http.Client{}
	resp, err := c.Do(req)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	if resp.StatusCode != http.StatusOK {
		return fmt.Errorf("interrupt workflow failed, status code: %d", resp.StatusCode)
	}

	return nil
}
